package py.progweb.sgc.gui.client.widget;

import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;

public class ToolbarPago extends ToolStrip {
	
	public static int TOOLBAR_BOTON_PAGO = 0;
	
	final ToolbarListener listener;
	
	public ToolbarPago(ToolbarListener listener) {
		this(listener, new int []{TOOLBAR_BOTON_PAGO});
	}

	public ToolbarPago(ToolbarListener listener, int [] botones) {
		ToolStripButton btnPagar;
		
		this.listener = listener;
		this.setWidth100();
		
		if (botones != null) {
			for (int btn : botones) {
				if (btn == TOOLBAR_BOTON_PAGO) {
					btnPagar = new ToolStripButton();
					btnPagar.setIcon("/sgc-web/images/edit.gif");
					btnPagar.setTitle("Generar Pago");
					this.addButton(btnPagar);
					
					btnPagar.addClickHandler(new ClickHandler() {
						public void onClick(ClickEvent event) {
							ToolbarPago.this.listener.modificar();
						}
					});
				}
			}
		}
	}

}
